<template>
  <div>
    <h3>组件通讯ref</h3>
    <bangDing ref="bangDing" />
    <button @click="handclick">获取子组件数据，或者调用子组件方法</button>
  </div>
</template>

<script>
import bangDing from './child.vue'
export default {
  name: 'ref',
  components: {
    bangDing
  },
  methods: {
    handclick() {
      console.log(this.$refs.bangDing.name)
      this.$refs.bangDing.childFn('world')
    }
  }
}
</script>

<style lang="scss" scoped></style>
